package com.pratices.cookie.bean;

import lombok.Data;

/**
 * vo => view object => 视图对象
 */
@Data
public class BaseRespVo<T> {
    private int code;
    private String message;
    private T data;


    public static <T> BaseRespVo<T> ok(T data) {
        BaseRespVo<T> respVo = new BaseRespVo<>();
        respVo.setCode(0);
        respVo.setMessage("成功");
        respVo.setData(data);
        return respVo;
    }

    // 也可以提供fail等其他方法
    public static BaseRespVo fail(String message) {
        BaseRespVo baseRespVo = new BaseRespVo();
        baseRespVo.setCode(500);
        baseRespVo.setMessage(message);
        return baseRespVo;
    }

}
